package com.uranus.auth.auth.controller;


import com.uranus.auth.auth.request.user.*;
import com.uranus.auth.auth.service.UserService;
import com.uranus.common.VO.Result;
import com.uranus.common.VO.paging.PagingRequest;
import com.uranus.common.constant.enums.LoginTypeEnum;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ybx
 * @since 2018-12-21
 */
@RestController
@RequestMapping("/users")
public class UserController {
    @Autowired
    UserService userService;

    @PostMapping()
    @ApiOperation(value = "用户管理 添加用户，内置角色")
    public Result create(@RequestBody CreateUserRequest req) {
        return Result.buildSuccess();
    }

    @PutMapping()
    @ApiOperation(value = "用户基本信息修改")
    public Result update(@RequestBody UpdateUserRequest req) {
        return Result.buildSuccess();
    }

    @PutMapping("/password")
    @ApiOperation(value = "修改密码")
    public Result updatePassword(@RequestBody UpdatePasswordRequest req) {
        return Result.buildSuccess();
    }

    @PutMapping("/password/forget")
    @ApiOperation(value = "忘记密码")
    public Result forgetPassword(@RequestBody ForgetPasswordRequest req) {
        return Result.buildSuccess();
    }

    @PutMapping("/mobile")
    @ApiOperation(value = "绑定手机")
    public Result bindMobile(@RequestBody BindMobileRequest req) {
        return Result.buildSuccess();
    }

    @PutMapping("/email")
    @ApiOperation(value = "绑定邮箱")
    public Result bindEmail() {
        return Result.buildSuccess();
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "获取用户详情")
    public Result queryById(@PathVariable Integer id) {
        return Result.buildSuccess();
    }

    @GetMapping("/{checkType}/{checkValue}")
    @ApiOperation(value = "检查手机号或邮箱是否存在")
    public Result checkByMobile(@PathVariable LoginTypeEnum checkType, @PathVariable String checkValue) {
        return Result.buildSuccess();
    }

    @PostMapping("/search")
    @ApiOperation(value = "分页多条件查询")
    public Result search(@RequestBody QueryUserRequest pagingRequest) {
        return userService.search(pagingRequest);
    }




}
